<?php

class UserService
{
	public static function login($username,$password) {
		$aField=array('u_name'=>$username,'u_password'=>md5($password));
		$userInfo=ModelFactory::get('UserModel')->getByField($aField);
		if(!$userInfo) return false;
		CoreFactory::session()->set('userInfo',$userInfo);
		return true;
	}
	
	public static function logout() {
		CoreFactory::session()->remove('userInfo');
		return true;
	}
	
	public static function isLogined() {
		if(CoreFactory::session()->contains('userInfo')) return true;
		else return false;
	}
}

?>